// BorrowRule.java - 借阅规则实体类
package com.library.entity;

public class BorrowRule {
    private Reader.ReaderType readerType;
    private int maxBorrowCount;
    private int maxBorrowDays;
    private int maxRenewTimes;
    private boolean canReserve;
    private int maxReserveCount;
    private double overdueFineRate; // 超期罚款率（元/天）

    public BorrowRule(Reader.ReaderType readerType, int maxBorrowCount, 
                     int maxBorrowDays, int maxRenewTimes, boolean canReserve, 
                     int maxReserveCount, double overdueFineRate) {
        this.readerType = readerType;
        this.maxBorrowCount = maxBorrowCount;
        this.maxBorrowDays = maxBorrowDays;
        this.maxRenewTimes = maxRenewTimes;
        this.canReserve = canReserve;
        this.maxReserveCount = maxReserveCount;
        this.overdueFineRate = overdueFineRate;
    }

    // Getter和Setter方法
    public Reader.ReaderType getReaderType() { return readerType; }
    public void setReaderType(Reader.ReaderType readerType) { this.readerType = readerType; }

    public int getMaxBorrowCount() { return maxBorrowCount; }
    public void setMaxBorrowCount(int maxBorrowCount) { this.maxBorrowCount = maxBorrowCount; }

    public int getMaxBorrowDays() { return maxBorrowDays; }
    public void setMaxBorrowDays(int maxBorrowDays) { this.maxBorrowDays = maxBorrowDays; }

    public int getMaxRenewTimes() { return maxRenewTimes; }
    public void setMaxRenewTimes(int maxRenewTimes) { this.maxRenewTimes = maxRenewTimes; }

    public boolean canReserve() { return canReserve; }
    public void setCanReserve(boolean canReserve) { this.canReserve = canReserve; }

    public int getMaxReserveCount() { return maxReserveCount; }
    public void setMaxReserveCount(int maxReserveCount) { this.maxReserveCount = maxReserveCount; }

    public double getOverdueFineRate() { return overdueFineRate; }
    public void setOverdueFineRate(double overdueFineRate) { this.overdueFineRate = overdueFineRate; }

    @Override
    public String toString() {
        return String.format("%s规则: 可借%d本, 借期%d天", readerType, maxBorrowCount, maxBorrowDays);
    }
}